package com.deyuanyun.pic.pipe.service.impl;

import com.deyuanyun.pic.common.util.StringUtils;
import com.deyuanyun.pic.pipe.domain.Gww;
import com.deyuanyun.pic.pipe.domain.Identification;
import com.deyuanyun.pic.pipe.mapper.dao.PipeGeneralDao;
import com.deyuanyun.pic.pipe.service.PipeGeneralService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.HashMap;

/**
 * “管道基础信息通用方法” 服务 具体实现类
 *
 * @author huanglw
 * @date  2016-11-17
 *
 * History: [修改人][时间][修改描述]
 */
@Service
public class PipeGeneralServiceImpl implements PipeGeneralService {

    @Resource
    private PipeGeneralDao pipeGeneralDao;

    @Override
    public Identification findLatelyIdentification(String pipeLineId, BigDecimal mileage) {

        if (StringUtils.isNullEmpty(pipeLineId) || null == mileage){
            return null;
        }

        HashMap hashMap = new HashMap();
        hashMap.put("pipeLineId", pipeLineId);
        hashMap.put("mileage", mileage);
        return pipeGeneralDao.findLatelyIdentification(hashMap);
    }

    @Override
    public Gww findUGWW(String pipeLineId, BigDecimal mileage) {

        if (StringUtils.isNullEmpty(pipeLineId) || null == mileage){
            return null;
        }

        HashMap hashMap = new HashMap();
        hashMap.put("pipeLineId", pipeLineId);
        hashMap.put("mileage", mileage);
        return pipeGeneralDao.findUGWW(hashMap);
    }
}
